/**
 * Created by yujianfu on 2019/9/11.
 */
import React from 'react'

import {Table,Card, Row, Col, Form, DatePicker, Button, Select, Radio} from 'antd'
const {RangePicker} = DatePicker
const FormItem = Form.Item
const {Option} = Select;
import img3 from '../../assets/merchant/img3.png'
import {fetchPost} from '../../utils/request'
import moment from 'moment'
import ReportCommon from './ReportCommon'
import Styles from './Dashboard.less'

class Profit extends React.Component {

    constructor(props) {
        super(props)
        this.state = {
            inputMoney: 0
        }
    }

    componentDidMount() {
        this.getInputMoney();
    }

    getInputMoney() {
        var queryKey = "totalInputMoney";
        fetchPost(`/bizStats/general/query`, {queryKey}).then(json => {

            if (json && json.data != null && JSON.stringify(json.data) != '{}' && json.code === 0) {
                let keyList = json.data[`${queryKey}KeyList`]
                let data = json.data[queryKey]
                console.log(data);
                this.setState({
                    inputMoney: data[0].inputAmount
                })
            }
        });
    }

    render() {
        return (
            <div>
                <Row gutter={24}>
                    <Col span={6}>
                        <Card bordered={true}>
                            <div className={Styles.logo}>
                                <img width='50px' height='50px' className={Styles.logo} src={img3}/>
                            </div>
                            <div className={Styles.number}>
                                <span>投入本金(₹)</span>
                                <h1>{this.state.inputMoney}</h1>
                            </div>
                        </Card>
                    </Col>
                </Row>
                <ReportCommon params={this.state.params} queryKey="loanAndRepaymentProduct" name="详情"/>
            </div>
        )
    }
}
const a = Form.create()(Profit)
export default a

